<%@page import="com.elookinto.wordlist.MobileDeviceDetector"%>
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*, java.sql.*, javax.sql.*, org.brickred.socialauth.*"%>
<%
    Cookie cookies[] = request.getCookies();
    Cookie myCookie = null;
    String cookieUid = "uid";
    if (cookies != null) {
        for (int i = 0; i < cookies.length; i++) {
            // out.println(cookies[i].getName() + "--- " + cookies[i].getValue() + "<br/>");
            if (cookies[i].getName().equals(cookieUid)) {
                myCookie = cookies[i];
                break;
            }

        }
    }
    String uid = null;
    String loginAccount = null;
    if (session.getAttribute("uid") == null) {
        SocialAuthManager manager = (SocialAuthManager) session.getAttribute("authManager");
        try {
            if (manager != null) {
                java.util.Map<String, String> paramsMap = org.brickred.socialauth.util.SocialAuthUtil.getRequestParametersMap(request);
                AuthProvider provider = manager.connect(paramsMap);
                if (provider != null) {
                    Profile p = provider.getUserProfile();
                    if (p != null && p.getEmail() != null) {
                        uid = p.getEmail();
                    } else {
                        uid = p.getFullName() + p.getDisplayName();
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        loginAccount = uid;
    }

    if (uid != null) {
        session.setAttribute("uid", uid);
    } else {
        if (myCookie != null) {
            uid = myCookie.getValue();
            session.setAttribute("uid", uid);
        } else {
            uid = request.getRemoteHost();
            session.setAttribute("uid", uid);
        }
    }
    //out.println("uid=" + uid);
    Cookie cookie = new Cookie("uid", session.getAttribute("uid").toString());
    cookie.setMaxAge(365 * 24 * 60 * 60);
    response.addCookie(cookie);
%>
<!DOCTYPE html>
<html>
    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
        <meta name="title" content=" YouAudio" />
        <meta name="description" content=" You audio " />
        <meta property="og:title" content="Word List" /> 
        <meta property="og:description" content="This word list app is the best tool to help boost your/your family vocabulary. " /> 
        <title> You Audio </title>
        <link rel="stylesheet" type="text/css" href="../css/wordlist.css"/> 
        <link rel="stylesheet" type="text/css" href="../css/button.css"/> 
        <link rel="stylesheet" type="text/css" media="screen" href="../css/atd.css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="../js/jquery.cookie.js"></script>
        <script type="text/javascript" src="../js/jquery.limit.js"></script>
        <script src="../js/jquery.atd.textarea.js"></script>
        <script src="../js/csshttprequest.js"></script>
        <script type="text/javascript" src="../js/wordlist.js"></script>
        <script type="text/javascript">

            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'UA-9033082-1']);
            _gaq.push(['_trackPageview']);

            (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
            })();

        </script>
        <script type="text/javascript">
            $.ajaxSetup({
                contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
            });
            $(document).ready(function() {
                
             
               startLoop();

            });
            
            var iFrequency = 5000; // expressed in miliseconds
            var myInterval = 0;

            // STARTS and Resets the loop if any
            function startLoop() {
                if(myInterval > 0) clearInterval(myInterval);  // stop
                myInterval = setInterval( " $('#k').attr('src', 'http://elookinto.com/pics/k' + $('input[name=sl]:checked').val() +'.jpg?' + (new Date()).getTime()); ", iFrequency );  // run

            }
          
         
        </script>



    </head>
    <body>
        <div class="wrapper">
            <div id="fb-root"></div>
            <div>
                <div class="topmenu"> <a href="/wordlist"> Wordlist </a> <a href="/wordlist_chinese"> ChineseWordlist </a>  <a href="/youaudio"> YouAudio </a>  
                    <a href="/wordlist/ks"> Kaleidoscope </a>
                </div>
                <h2 align="center"> Kaleidoscope
                </h2>
                <!--
                <button onclick="alert($('input[name=sl]:checked').val() )"> b </button> -->
                <br/><br/>
            </div>



            <div style="text-align: center">
                Shape Only:<input name="sl" type="radio" value="0" />  Mixed:<input name="sl" type="radio" value="1" checked="checked"/> Images Only: <input name="sl" type="radio" value="2" />
                <br/>
                <br/>
                
                <img id="k" src="/pics/k1.jpg" />

                <div class="push"> </div>
            </div>
            <div class='footer' style="width:100%;text-align:center">

                Copyright (c) 2012, elookinto.  <a style="text-decoration: none" href="https://groups.google.com/forum/?fromgroups#!forum/wordlists" target="support"> Support Forum </a>

            </div>

        </div>

    </body>
</html>

